package com.whimscrew.user.controller;

import com.whimscrew.user.model.User;
import com.whimscrew.user.service.DeptService;
import com.whimscrew.user.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("v1/user")
public class UserController {


    @Autowired
    UserService userService;

    @Autowired
    DeptService deptService;


    @PostMapping
    public User saveUser(String userName) throws InterruptedException {
        return userService.save(userName);
    }

    @GetMapping("dept")
    public String userDept( )   {
        return  deptService.getDept();
    }


}
